package com.jishuo.nontax.web;

import com.jishuo.base.annotation.UserAuthority;
import com.jishuo.base.bean.BaseResult;
import com.jishuo.base.bean.GridResult;
import com.jishuo.base.bean.Pagination;
import com.jishuo.nontax.bean.vo.BankVO;
import com.jishuo.nontax.bean.vo.QueryBankDateVO;
import com.jishuo.nontax.bean.vo.QueryMessageVO;
import com.jishuo.nontax.bfc.service.QueryService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;

/**
 * 查询统计
 *
 * @auther dinggaofei
 * @Date 2023/3/20 17:30
 */
@Slf4j
@Controller
@RequestMapping(value = "/query")
@UserAuthority(menu = {"query/bankstatindex"})
public class QueryController {

    @Resource
    private QueryService queryService;

    private String prefix = "query/";

    @RequestMapping(value = {"bankstatindex", "bankstatindex/{page}"}, name = "按银行账户统计")
    public String index(@PathVariable(required = false) String page) {
        return prefix + ((page == null) ? "bankstatindex" : page);
    }

    @RequestMapping(value = {"querybankfordateindex", "querybankforindex/{page}"}, name = "日处理业务量分析")
    public String queryabankfordateindex(@PathVariable(required = false) String page) {
        return prefix + ((page == null) ? "querybankfordateindex" : page);
    }

    @RequestMapping(value = {"cantonstatindex", "cantonstatindex/{page}"}, name = "按行政区划统计")
    public String cantonstatindex(@PathVariable(required = false) String page) {
        return prefix + ((page == null) ? "cantonstatindex" : page);
    }

    @RequestMapping(value = {"querymessagelogindex", "querymessagelogindex/{page}"}, name = "日志处理")
    public String querymessageLogindex(@PathVariable(required = false) String page) {
        return prefix + ((page == null) ? "querymessagelogindex" : page);
    }

    @ResponseBody
    @RequestMapping(value = "queryBank", name = "银行账户统计列表")
    public GridResult<BankVO> queryBank(BankVO bankVO, Pagination pagination) {
        return new GridResult<>(queryService.queryBank(bankVO, pagination));
    }


    @ResponseBody
    @RequestMapping(value = "querybankfordate", name = "日处理业务列表")
    public GridResult<QueryBankDateVO> querybankfordate(Long bankid, String paybankdt, Pagination pagination) {
        return new GridResult<>(queryService.querybankfordate(bankid, paybankdt, pagination));
    }

    @ResponseBody
    @RequestMapping(value = "queryMessageLog", name = "消息日志列表")
    public GridResult<QueryMessageVO> queryMessageLog(String action, String senddate, String types, Pagination pagination) {
        return new GridResult<>(queryService.queryMessageLog(action, senddate, types,pagination));
    }

    @ResponseBody
    @RequestMapping(value = "updateMessageState", name = "修改消息日志状态")
    public BaseResult updateMessageState(Long messageid) {
        return queryService.updateMessageState(messageid);
    }
}
